package com.ycfmedical.bed.present;


import android.os.Handler;

import com.ycfmedical.bed.Constants;
import com.ycfmedical.bed.listener.SplashView;
import com.ycfmedical.bed.ui.SplashActivity;
import com.ycfmedical.bed.utils.ShareUtil;

import cn.droidlover.xdroidmvp.mvp.XPresent;


/**
 * 闪屏界面逻辑
 */
public class SplashPresenter extends XPresent<SplashActivity>{

    SplashView view;
    public SplashPresenter(SplashView view) {
        this.view = view;
    }

    /**
     * 加载页面逻辑
     */
    public void startLoginIm() {
        new Handler().post(new Runnable() {
            @Override
            public void run() {
                if (view.isUserLogin()) {
                    view.loginIm();
                } else {
                    view.loginTls();
                }
            }
        });
    }



    public void savaPageValue(int pageValue) {
        if (pageValue == Constants.NUM_DEFAULT)
        {
            pageValue = Constants.NUM_CONTROIL;
        }
        ShareUtil.getInstance().saveInt(Constants.SHARE_HOMETAB_KEY,pageValue);

    }
}
